<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/2/28
 * Time: 22:06
 */

namespace app\common\model;

use think\Model;

class Article extends Model
{
    use \app\common\model\traits\Status;

    /**
     * 主键
     * @var string
     */
    protected $pk = 'id';

    /**
     * 表
     * @var string
     */
    protected $table = 'article';


    /**
     * 类型自动转换
     * @var array
     */
    protected $type = [
        'status'       => 'integer',
        'cid'          => 'integer',
        'uid'          => 'integer',
        'viewed'       => 'integer',
        'dis_order'    => 'integer',
        'created_time' => 'datetime',
        'updated_time' => 'datetime',
    ];

    /**
     * 文章详情
     * @return \think\model\relation\HasMany
     */
    public function detail()
    {
        return $this->hasMany(ArticleDetail::class, 'id');
    }


}